import {
	storageTokenKey, storageUserType
} from '@/global/config.js'

export default {
	data() {
		return {
			isLoading: true
		}
	},
	onLoad(options) {
		let source = options.source || ""
		let isFromApp = (source == "app_android") || (source == "app_ios")
		if(isFromApp) {
			let token = options.token || ""
			uni.setStorageSync(storageTokenKey, token)
			
			let roleType = options.roleType || "0"   //0: 普通用户  1:助教用户
			if(roleType == "0") {
				uni.setStorageSync(storageUserType, "1")
			} else {
				uni.setStorageSync(storageUserType, "2")
			}
			
			getApp().globalData.isFromApp = true
		} else {
			getApp().globalData.isFromApp = false
		}
	}
}